class MyCircularQueue {
    int[] elem;
    int usedSize;
    int rear;
    int front;
    public MyCircularQueue(int k) {
    elem = new int[k];
    }
    
    public boolean enQueue(int value) {
        if(isFull())return false;
    if(usedSize == 0){
        elem[rear] = value;
        usedSize++;
        return true;
    }
    rear = (rear+1)%(elem.length);
    elem[rear] = value;
    usedSize++;
    return true;
    }
    
    public boolean deQueue() {
    if(isEmpty())return false;
    if(rear == front){
        usedSize--;
        return true;
    }
    front = (front+1)%(elem.length);
    usedSize--;
    return true;
    }
    
    public int Front() {
        if(isEmpty())return -1;
    return elem[front];
    }
    
    public int Rear() {
        if(isEmpty())return -1;

        return elem[rear];
    }
    
    public boolean isEmpty() {
    if(usedSize == 0)return true;
    return false;
    }
    
    public boolean isFull() {
    if(usedSize == elem.length)return true;
    return false;
    }
}